package initialize

import (
	"awesomeProject/user-web/middlewares"
	routerPkg "awesomeProject/user-web/router"
	"github.com/gin-gonic/gin"
)

func Router() *gin.Engine {
	router := gin.Default()
	router.Use(middlewares.Cors()) // 给所有的url都配置我们自定义的cors，解除跨域限制
	router.GET("/health", func(c *gin.Context) {
		c.JSON(200, gin.H{"status": "ok"})
	})

	ApiGroup := router.Group("/u/v1")
	//
	routerPkg.InitUserRouter(ApiGroup)
	routerPkg.InitBaseRouter(ApiGroup)

	return router
}
